<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
	xmlns:t="https://code.google.com/p/rad-framework/taglib"
	xmlns:tt="https://code.google.com/p/rad-framework"
	xmlns:s="http://jboss.com/products/seam/taglib" template="#{theme.layout}">
	
	<ui:param name="title" value="The following error has occurred"/>
	
	<ui:define name="crumbs">
	</ui:define>
	
	<ui:define name="left">
		<a4j:form id="sidebarForm">
			<rich:panel style="width:192px" styleClass="rich-panel-action">
				<h:commandLink
					rendered="#{rad.framework.seam.currentException.exception == null}"
					styleClass="rad-framework-action-panel"
					action="#{rad.framework.seam.currentException.simulate}" >
					<h:outputText styleClass="rad-framework-action-error" value="#{messages['SimulateError']}" />	
				</h:commandLink>
			</rich:panel>
			<rich:spacer width="1" height="15" />
			<ui:include src="/themes/default/includes/recent.xhtml" />
		</a4j:form>
	</ui:define>

	<ui:define name="center">
			<h:form id="errorForm">

				<rich:dataTable value="#{rad.framework.seam.currentException.invalidValues}" var="kid"
					rendered="#{not empty rad.framework.seam.currentException.invalidValues}"
					width="100%" id="errorTable">
					
					<f:facet name="header">
						<rich:columnGroup>
							<h:column>
								<h:outputText value="Type"/>
							</h:column>
							<h:column>
								<h:outputText value="Field"/>
							</h:column>
							<h:column>
								<h:outputText value="Message"/>
							</h:column>
							<h:column>
								<h:outputText value="Value"/>
							</h:column>
						</rich:columnGroup>
					</f:facet>
					
					<h:column>
						<h:outputText value="#{kid.beanClass.simpleName}"/>
					</h:column>
					<h:column>
						<h:outputText value="#{kid.propertyName}"/>
					</h:column>
					<h:column>
						<h:outputText value="#{kid.message}"/>
					</h:column>
					<h:column>
						<h:outputText value="#{kid.value}"/>
					</h:column>
				</rich:dataTable>
								
				<rich:jQuery selector="#errorTable tr:odd" query="addClass('rad-framework-row-odd')" />
				<rich:jQuery selector="#errorTable tr:even" query="addClass('rad-framework-row-even')" />
				<rich:jQuery selector="#errorTable tr" query="mouseover(function(){jQuery(this).addClass('rad-framework-row-over')})"/>
				<rich:jQuery selector="#errorTable tr" query="mouseout(function(){jQuery(this).removeClass('rad-framework-row-over')})"/>
				
				<rich:spacer width="1" height="20"/>
				
				<rich:simpleTogglePanel switchType="client" label="Advanced"
					rendered="#{rad.framework.seam.currentException.exception != null}"
					opened="false">
					<f:facet name="openMarker">
						<h:graphicImage
							value="/themes/default/images/rich-panel-header-max.gif"/>
					</f:facet>
					<f:facet name="closeMarker">
						<h:graphicImage
							value="/themes/default/images/rich-panel-header-min.gif"/>
					</f:facet> Caused by #{rad.framework.seam.currentException.exception.class.name} with message:
					"#{rad.framework.seam.currentException.exception.message}"
					
					<pre>
					<ui:repeat value="#{rad.framework.seam.currentException.exception.stackTrace}" var="stackElement">
	#{stackElement}
					</ui:repeat>
				</pre>
					</rich:simpleTogglePanel>
			</h:form>
	</ui:define>
</ui:composition>